(function($){  
	
	/**
	 * Check if element is inside the panel (#xBertPanel) or any of the floating editors:
	 * 	-> .x-colorpicker
	 *  -> .x-editable-select-popup
	 *  -> .ui-dialog
	 *  -> .ui-widget-overlay
	 *  
	 * @param {Object} options
	 */
	$.fn.xInPanelOrPopups = function(bAllMustBe) {
		var classesToCheck = [ 'x-panel', 'x-colorpicker', 'x-editable-select-popup', 'ui-dialog', 'ui-widget-overlay' ];
		var isInside = bAllMustBe ? true : false;
		
		this.each(function() {
			var i, $this = $(this);
			for(i = 0; i < classesToCheck.length; i++) {
				if($this.hasClass(classesToCheck[i]) || $this.parents('.' + classesToCheck[i]).length > 0) {
					isInside = bAllMustBe ? (isInside && true) : (isInside || true);
				}
			}
		});
		
		return isInside;
	};

    
      
})(jQuery);  